Move configuration to new YGConfig and pass them down to CalculateLayout#432
Move configuration to new YGConfig and pass them down to CalculateLayout#432woehrl01 wants to merge 11 commits intofacebook:masterfrom
Conversation
emilsjolander
left a comment
There was a problem hiding this comment.
Minor comments. Looks very good! Thanks a ton for this
yoga/Yoga.h
Outdated
| WIN_EXPORT YGConfigRef YGConfigNew(void); | ||
| WIN_EXPORT void YGConfigFree(const YGConfigRef config); | ||
|
|
||
| WIN_EXPORT void YGSetExperimentalFeatureEnabled(YGConfigRef config, |
There was a problem hiding this comment.
const for params please
yoga/Yoga.c
Outdated
| YGConfigRef YGConfigNew(void) { | ||
| const YGConfigRef config = gYGMalloc(sizeof(YGConfig)); | ||
| YG_ASSERT(config, "Could not allocate memory for config"); | ||
| gNodeInstanceCount++; |
There was a problem hiding this comment.
remove gNodeInstanceCount++ as this is not allocating a node. I don't think we care about tracking these allocations right now.
| static YGConfig gYGConfigDefaults = { | ||
| .experimentalFeatures = | ||
| { | ||
| [YGExperimentalFeatureRounding] = false, |
There was a problem hiding this comment.
please uses spaces for indentation
There was a problem hiding this comment.
those are spaces, the formater is layouting it like that.
yoga/Yoga.c
Outdated
| }, | ||
| }; | ||
|
|
||
| static YGConfig gYGConfigDefaults = { |
| float aspectRatio; | ||
| } YGStyle; | ||
|
|
||
| typedef struct YGConfig { bool experimentalFeatures[YGExperimentalFeatureCount + 1]; } YGConfig; |
There was a problem hiding this comment.
can you put this on multiple lines / run formatter?
There was a problem hiding this comment.
sorry, but the layouter is formating it like that, I think we need to add a second value to layout it differently. As soon as you add float pointScale this should be layouted as desired.
There was a problem hiding this comment.
Hehe ok. The format config still needs some tweaking i guess. No problem
yoga/Yoga.h
Outdated
| WIN_EXPORT void YGConfigFree(const YGConfigRef config); | ||
|
|
||
| WIN_EXPORT void YGSetExperimentalFeatureEnabled(const YGConfigRef config, | ||
| YGExperimentalFeature feature, |
There was a problem hiding this comment.
feature and enabled const please :)
yoga/Yoga.c
Outdated
| inline bool YGIsExperimentalFeatureEnabled(YGExperimentalFeature feature) { | ||
| return experimentalFeatures[feature]; | ||
| inline bool YGIsExperimentalFeatureEnabled(const YGConfigRef config, | ||
| YGExperimentalFeature feature) { |
yoga/Yoga.c
Outdated
| void YGSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled) { | ||
| experimentalFeatures[feature] = enabled; | ||
| void YGSetExperimentalFeatureEnabled(const YGConfigRef config, | ||
| YGExperimentalFeature feature, |
|
@emilsjolander has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
I'll most likely land this next week. It takes a while to integrate bigger changes like this into internal usages 👍 Thanks for the hard work! |
|
@emilsjolander fully reasonable! Do you also add the other missing languages? |
|
Yup! |
|
Awesome! |
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes facebook/yoga#432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes facebook/yoga#432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes facebook/yoga#432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Move configuration to new
YGConfigand pass them down to CalculateLayout. See #418 .Adds
YGConfigNew()+YGConfigFree, and changedYGSetExperimentalFeatureEnabledto use the config.New function for calculation is
YGNodeCalculateLayoutWithConfig.